<?php
	session_start();
	require_once("action/Constants.php");
	require_once("action/dao/Connection.php");
	require_once("action/utils/Translator.php");
	
	class CommonAction {
//		private $visibilty;
		private $translator;
//		public function __construct($visibilty) {
//			$this->visibilty = $visibilty;
//		}
		
		public function __construct() {
			
		}
		
		public function execute() {
			if($_SESSION["currentLang"] == null)
				$_SESSION["currentLang"] = 'fr';
				
			if (isset($_GET["lang"]) && strlen($_GET["lang"]) > 0) {
				$_SESSION["currentLang"] = $_GET["lang"];
			}
			$this->translator = new Translator($_SESSION["currentLang"]);
		}
	
		protected function setFullName($name) {
			$_SESSION["name"] = $name;
		}
		
		public function getFullName() {
			return $_SESSION["name"];
		}
		
		public function getTranslator() {
			return $this->translator;
		}
			public function isLoggedIn() {
			return strcmp($_SESSION["Authentifier"], "oui") == 0;
		}
		
		protected function setLoggedIn($loggedIn) {
			if ($loggedIn) {
				$_SESSION["Authentifier"] = "oui";
			}
			else {
				unset($_SESSION["Authentifier"]);
			}
		}
	}


